<template>
  <el-row>
    <el-col :span="24">
      <el-form-item :label="$t('公司网址')" prop="companyUrl">
        <el-input v-model="equityForm.companyUrl" :placeholder="$t('公司网址')" show-word-limit :maxlength="200" />
      </el-form-item>
    </el-col>
    <el-col :span="12">
      <el-form-item :label="$t('聚焦行业')" prop="industryFocus">
        <FocusIndustry :industry-data="equityForm.industryFocusList" @industryFocusList="getIndustryFocusList" />
      </el-form-item>
    </el-col>
    <el-col :span="12">
      <el-form-item :label="$t('投资轮次')" prop="round">
        <el-select v-model="equityForm.round" multiple :placeholder="$t('投资轮次')">
          <el-option
            v-for="dict in roundsInvestmentOptions"
            :key="dict.dictValue"
            :label="$t(dict.dictLabel)"
            :value="dict.dictValue"
          />
        </el-select>
      </el-form-item>
    </el-col>
    <el-col :span="12">
      <el-form-item :label="$t('投资类型')" prop="investmentType">
        <dictSelect
          v-model="equityForm.investmentType"
          :clearable="true"
          dictionary="equity_investment_type"
        />
      </el-form-item>
    </el-col>
    <el-col :span="12">
      <el-form-item :label="$t('公司类型')" prop="companyType">
        <dictSelect
          v-model="equityForm.companyType"
          :clearable="true"
          dictionary="company_type"
        />
      </el-form-item>
    </el-col>
    <el-col :span="12">
      <el-form-item v-if="equityForm.companyType === 'YXGS'" :label="$t('注册资本') + $t('金额单位')" prop="totalShare">
        <Money v-model="equityForm.totalShare" unit="w" :placeholder="$t('注册资本') + $t('金额单位')" />
      </el-form-item>
      <el-form-item v-else :label="$t('公司总股数(万股)')" prop="totalShare">
        <Money v-model="equityForm.totalShare" unit="w" :is-error="false" :placeholder="$t('公司总股数(万股)')" @cvalue="onHandle" />
        <div solt="error" class="el-form-item__error">{{ errorMsg }}</div>
      </el-form-item>
    </el-col>
    <el-col :span="12">
      <el-form-item :label="$t('投前估值') + $t('金额单位')" prop="valuationBeforeInvestment">
        <Money v-model="equityForm.valuationBeforeInvestment" unit="w" :placeholder="$t('投前估值')" />
      </el-form-item>
    </el-col>
    <el-col :span="12">
      <el-form-item :label="$t('投后估值') + $t('金额单位')" prop="valuationBeforeInvestment">
        <Money v-model="equityForm.valuationAfterInvestment" unit="w" :placeholder="$t('投后估值')" />
      </el-form-item>
    </el-col>
    <el-col :span="12">
      <el-form-item :label="$t('预计退出时间')" prop="estimatedExitTime">
        <DatePicker v-model="equityForm.estimatedExitTime" :placeholder="$t('预计退出时间')" />
      </el-form-item>
    </el-col>
    <el-col :span="24">
      <el-form-item :label="$t('退出计划')" prop="planExit">
        <el-input v-model="equityForm.planExit" :placeholder="$t('退出计划')" type="textarea" :maxlength="2000" show-word-limit />
      </el-form-item>
    </el-col>
    <el-col :span="24">
      <el-form-item :label="$t('收入情况')" prop="income">
        <el-input v-model="equityForm.income" :placeholder="$t('收入情况')" type="textarea" :maxlength="2000" show-word-limit />
      </el-form-item>
    </el-col>
    <el-col :span="24">
      <el-form-item :label="$t('利润情况')" prop="profitIs">
        <el-input v-model="equityForm.profitIs" :placeholder="$t('利润情况')" type="textarea" :maxlength="2000" show-word-limit />
      </el-form-item>
    </el-col>
    <el-col :span="24">
      <el-form-item :label="$t('专利信息')" prop="patentInformation">
        <el-input v-model="equityForm.patentInformation" :placeholder="$t('专利信息')" type="textarea" :maxlength="2000" show-word-limit />
      </el-form-item>
    </el-col>
  </el-row>
</template>

<script>
    export default {
      name: 'DealBaseEquityForm',
      props: {
        // form
        equityForm: {
          type: Object,
          default: undefined
        }
      },
      data() {
        return {
          // 投资轮次
          roundsInvestmentOptions: [],
          // 聚焦行业
          industryFocusOptions: [],
          errorMsg: ''
        }
      },
      created() {
        // 投资轮次
        this.getDicts('rounds_investment').then(response => {
          this.roundsInvestmentOptions = response.data
        })
        // 聚焦行业
        this.getDicts('deal_industry_focus').then(response => {
          this.industryFocusOptions = response.data
        })
      },
      mounted() {
      },
      methods: {
        onHandle(val) {
          // console.log(val)
          if (val > 999000000000000) {
            this.errorMsg = this.$t('不能大于千万亿')
            setTimeout(() => {
              this.errorMsg = ''
            }, 3000)
          } else {
            this.errorMsg = ''
          }
        },
        // 获取聚焦行业数据
        getIndustryFocusList(val) {
          this.equityForm.industryFocus = val[0]
          if (val[1]) {
            this.equityForm.industryFocusTwo = val[1]
          } else {
            this.equityForm.industryFocusTwo = ''
          }
        }
      }
    }
</script>
